package com.hgwz.spring.service.Impl;

import com.hgwz.spring.dao.MenuMapper;
import com.hgwz.spring.entity.Menu;
import com.hgwz.spring.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<Menu> getAllMenus(){
        return menuMapper.getAllMenus();
    }

    @Override
    public int addNewMenu(int cid, String mname, float price) {
        Menu menu = new Menu();
        menu.setCid(cid);
        menu.setMname(mname);
        menu.setPrice(price);
        return menuMapper.insert(menu);
    }

    @Override
    public int delMenuItem(int mid) {
        return menuMapper.delete(mid);
    }
}
